export const formatTime = (time) => {
  let date = new Date(time / 1),
    year = date.getFullYear(),
    // month = ("0"+date.getMonth() + 1).slice(-2);
    month = String(date.getMonth() + 1).padStart(2, "0"),
    // day = ("0" + date.getDate()).slice(-2),
    day = String(date.getDate()).padStart(2,"0"),
    // hour = ("0" + date.getHours()).slice(-2),
    hour = String(date.getHours()).padStart(2,"0"),
    // minute = ("0" + date.getSeconds()).slice(-2),
    minute = String(date.getMinutes()).padStart(2,"0"),
    // second = ("0" + date.getSeconds()).slice(-2);
    second = String(date.getSeconds()).padStart(2,"0");

  return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
};
export const formatDate = (time) => {
  let date = new Date(time / 1),
    year = date.getFullYear(),
    month = ("0" + (date.getMonth() + 1)).slice(-2),
    day = ("0" + date.getDate()).slice(-2),
    week = date.getDay(),
    weekTxt = "周一";

  switch (week) {
    case 0:
      weekTxt = "周日";
      break;
    case 1:
      weekTxt = "周一";
      break;
    case 2:
      weekTxt = "周二";
      break;
    case 3:
      weekTxt = "周三";
      break;
    case 4:
      weekTxt = "周四";
      break;
    case 5:
      weekTxt = "周五";
      break;
    case 6:
      weekTxt = "周六";
      break;
  }
  // 2022-06-21 周四
  return `${year}-${month}-${day} ${weekTxt}`;
};

export const formatDetail = (time) => {
  let date = new Date(time / 1),
    hour = ("0" + date.getHours()).slice(-2),
    minute = ("0" + date.getMinutes()).slice(-2),
    second = ("0" + date.getSeconds()).slice(-2);

  // 19:38:26
  return `${hour}:${minute}:${second}`;
};